<?php

class TarjetasVerdesValidator extends sfValidatorBase
{
	
	protected function configure($options = array(), $messages = array()) {
		$this->addOption('v');
		$this->addOption('0');
		$this->min = 0;
		$this->max = 5;

	}	
	
	protected function doClean($value)
	{

		$verdes = $value[$this->getOption('v')];
		if ($verdes !=null)
		{
			$verdes = intval($verdes);
			if ($verdes > $this->max || $verdes<$this->min) {
				//$this->messages = array('invalid' => 'La cantidad de tarjetas verdes es invalida'); 
				throw new sfValidatorError($this, 'invalid', array('value' => $value));
			
		}
		}
		
		
		return $value;
	}

}
?>